package com.CityHunter.Activity;

import java.util.ArrayList;
import java.util.HashMap;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.GridView;
import android.widget.SimpleAdapter;

import com.CityHunter.R;

public class MenuAct extends Activity {
	/** Called when the activity is first created. */
	private Integer[] imglist = { R.drawable.favb, R.drawable.clock,
			R.drawable.groupofusers, R.drawable.mail, R.drawable.find,
			R.drawable.web ,R.drawable.network,R.drawable.infoabout};
	private String[] imgTextlist = { "Myfavourite", "Schedule", "Friend",
			"Buddy", "Search", "WhatNearMe" ,"Track","Help"};

	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.menu);
		GridView gridview = (GridView) findViewById(R.id.gv);

		ArrayList<HashMap<String, Object>> lstImageItem = new ArrayList<HashMap<String, Object>>();
		for (int i = 0; i < imglist.length; i++) {
			HashMap<String, Object> map = new HashMap<String, Object>();
			map.put("ItemImage", imglist[i]);
			map.put("ItemText", imgTextlist[i]);
			lstImageItem.add(map);
		}

		SimpleAdapter saImageItems = new SimpleAdapter(this, lstImageItem,
				R.layout.menu_item,

				new String[] { "ItemImage", "ItemText" },

				new int[] { R.id.ItemImage, R.id.ItemText });

		gridview.setAdapter(saImageItems);

		gridview.setOnItemClickListener(new ItemClickListener());
	}
	

	class ItemClickListener implements OnItemClickListener {
		public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
				long arg3) {

			Intent i = null;
			if (arg2==2)
				 i = new Intent(MenuAct.this, GroupView.class);
			if (arg2==6)
				 i = new Intent(MenuAct.this, TrackAct.class);
			if (arg2==3)
					 i = new Intent(MenuAct.this, BuddyPage.class);
					startActivity(i);
			
		}

	}
}